package com.lagou.homework.service;


import com.lagou.homework.bean.User;
import com.lagou.homework.dao.UserDao;
import com.lagou.homework.factory.UserDaoFactory;

/**
 * 根据合成复用原则编写方法实现用户登录
 */
public class UserService {

    private UserDao userDao;

    // 在构造方法中传入UserDao类型的对象(使用工厂方法创建UserDao类型的对象)
    public UserService() {
        this.userDao = UserDaoFactory.getUserDao();
    }

    /**
     * 自定义成员方法实现根据参数指定的User对象来调用Dao层实现用户登录
     * @param user
     * @return
     */
    public User userLoginService(User user) {
        return userDao.userLogin(user);
    }
}

